package com.toumy.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.toumy.domain.Book;
import com.toumy.service.IBookService;
import com.toumy.dao.BookDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookServiceImpl extends ServiceImpl<BookDao, Book> implements IBookService {

    @Autowired
    private BookDao bookDao;

    @Override
    public IPage page(int current, int size) {
        IPage iPage = new Page(current,size);
        IPage page = bookDao.selectPage(iPage, null);

        return page;
    }

    @Override
    public List<Book> SelectByCate(int cate) {
        return bookDao.selectByCate(cate);
    }

    @Override
    public List<Book> SelectByOwner(int owner) {
        return bookDao.selectByOwner(owner);
    }
}
